package shiyan11;

class Account{
	private int balance;
	
	public Account(int balance) {
		super();
		this.balance = balance;
	}

	public synchronized int getBalance() {
		return balance;
	}

	public synchronized void setBalance(int balance) {
		this.balance = balance;
	}
	void deposit(int money){
		synchronized (Account.class) {
			balance=balance+money;
			notify();
		}
		
	}
	void withdraw(int money){
		synchronized (Account.class) {
			if(balance>money)
		   balance=balance-money;
		else
			try {
				wait();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
	}
}
public class Sy44 {

}
